home *** CD-ROM | disk | FTP | other *** search
/ The Very Best of Atari Inside / The Very Best of Atari Inside 1.iso / mint / mint110s / makefile < prev    next >
Makefile  |  1994-02-16  |  7KB  |  244 lines

  1. #
  2. # Makefile for MiNT using the GCC
  3. #
  4.  
  5. # if you're cross-compiling, define NATIVECC
  6. # to the host's C compiler, NATIVECFLAGS to
  7. # the appropriate flags for it, and NATIVELIBS
  8. # to appropriate libraries
  9. # NATIVECC = cc -DNO_STDLIB
  10. # NATIVECFLAGS = -g
  11. # NATIVELIBS =
  12.  
  13. NATIVECC = gcc
  14. NATIVECFLAGS = -O
  15. NATIVELIBS = -liio
  16.  
  17. #
  18. # depending on your version of bison/yacc, you may
  19. # need to change these names, e.g. to
  20. # YACC = yacc
  21. # YTABC = y.tab.c
  22. # YTABH = y.tab.h
  23.  
  24. #YACC = bison
  25. #YTABC = asm_tab.c
  26. #YTABH = asm_tab.h
  27.  
  28. YACC = byacc -b y_
  29. YTABC = y_tab.c
  30. YTABH = y_tab.h
  31.  
  32. # here are defs for the cross compiler
  33. # MiNT must be compiled with 16 bit integers
  34.  
  35. CC = gcc
  36. AS = gcc
  37. MODEL = -mshort
  38. MODEL030 = -mshort -m68020
  39. LIBS = -liio16
  40.  
  41. # add -DMULTITOS for a MultiTOS kernel
  42. # add -DONLY030 for a version of MiNT that needs a 680x0, x>=3
  43. # add -DDEBUG_INFO for debugging information
  44.  
  45. DEFS = -DMULTITOS -DDEBUG_INFO
  46. #DEFS030 = -DMULTITOS -DONLY030
  47. DEFS030 = -DONLY030
  48.  
  49. #
  50. # if you have an older version of gcc, it won't understand -G;
  51. # that won't hurt anything (it just controls the format of the
  52. # symbol table) so just delete the -G. Do *not* change it into
  53. # -g!!!
  54. #
  55. CFLAGS = -G -Wall -O2 -fomit-frame-pointer $(MODEL) $(DEFS)
  56. ASFLAGS = $(MODEL)
  57. CFLAGS030 = -G -Wall -O2 -fomit-frame-pointer $(MODEL030) $(DEFS030)
  58. ASFLAGS030 = $(MODEL030)
  59.  
  60. COBJS = bios.o xbios.o console.o dos.o dosdir.o dosfile.o dosmem.o dossig.o \
  61.     filesys.o main.o mem.o proc.o signal.o timeout.o tty.o util.o \
  62.     biosfs.o pipefs.o procfs.o tosfs.o debug.o rendez.o \
  63.     unifs.o shmfs.o fasttext.o welcome.o nalloc2.o memprot.o realloc.o
  64.  
  65. COBJS030 = bios.o0 xbios.o0 console.o0 dos.o0 dosdir.o0 dosfile.o0 dosmem.o0 dossig.o0 \
  66.     filesys.o0 main.o0 mem.o0 proc.o0 signal.o0 timeout.o0 tty.o0 util.o0 \
  67.     biosfs.o0 pipefs.o0 procfs.o0 tosfs.o0 debug.o0 rendez.o0 \
  68.     unifs.o0 shmfs.o0 fasttext.o0 welcome.o0 nalloc2.o0 memprot.o realloc.o0
  69.  
  70. CFILES = bios.c xbios.c console.c dos.c dosdir.c dosfile.c dosmem.c dossig.c \
  71.     filesys.c main.c mem.c proc.c signal.c timeout.c tty.c util.c \
  72.     biosfs.c pipefs.c procfs.c tosfs.c debug.c rendez.c \
  73.     unifs.c shmfs.c fasttext.c welcome.c nalloc2.c memprot.c realloc.c
  74.  
  75. HFILES = assert.h atarierr.h basepage.h cookie.h ctype.h fasttext.h \
  76.     file.h inline.h mem.h mint.h proc.h proto.h signal.h sproto.h \
  77.     types.h version.h xbra.h
  78.  
  79. SFILES = context.spp cpu.spp intr.spp syscall.spp quickzer.spp \
  80.     quickmov.spp magic.i
  81.  
  82. SOBJS = context.o intr.o syscall.o quickzer.o quickmov.o cpu.o
  83. SOBJS030 = context.o0 intr.o0 syscall.o0 quickzer.o0 quickmov.o0 cpu.o0
  84.  
  85. OBJS = $(COBJS) $(SOBJS)
  86. OBJS030 = $(COBJS030) $(SOBJS030)
  87.  
  88. #all: mint.prg mint030.prg
  89.  
  90. mint.prg: $(OBJS)
  91.     $(CC) $(CFLAGS) -o mint.prg $(OBJS) $(LIBS)
  92. #    strip mint.prg
  93.  
  94. mint030.prg: $(OBJS030)
  95.     $(CC) $(CFLAGS030) -o mint030.prg $(OBJS030) $(LIBS)
  96. #    strip mint030.prg
  97.  
  98. $(SOBJS): proc.h
  99. $(COBJS): mint.h proc.h file.h
  100.  
  101. $(SOBJS030): proc.h
  102. $(COBJS030): mint.h proc.h file.h
  103.  
  104. main.o: version.h
  105. welcome.o: version.h
  106. bios.o: inline.h
  107.  
  108. memprot.o: memprot.c mint.h proc.h file.h
  109.     $(CC) $(CFLAGS) -m68020 -c memprot.c
  110.  
  111. main.o0: version.h
  112. welcome.o0: version.h
  113. bios.o0: inline.h
  114.  
  115. #
  116. # assembler source files are now handled in a radically different
  117. # fashion. We build a pre-processor program, asmtrans, that
  118. # takes the .spp files, merges them with an include file that
  119. # gives various offsets into structures of interest, and produces
  120. # the .s files as output. This has two major advantages:
  121. # (1) it lets us use the same source for both the Lattice and
  122. #     gcc assembler files (the translator will convert), and
  123. # (2) if we change the CONTEXT or PROC structures, we don't
  124. #     have to dig through the source code looking for
  125. #     magic numbers
  126.  
  127. # the asm translator program
  128. # Note that this must be compiled with the native CC of whatever
  129. # system you're using; see the definitions at the top of this
  130. # file.
  131.  
  132. ATRANSOBJ = asmtab.o trutil.o trans.o
  133. ATRANS = asmtrans.ttp
  134. ATRANSSRC = asm.y asmtab.c asmtab.h asmtrans.h trutil.c trans.c
  135.  
  136. $(ATRANS): $(ATRANSOBJ)
  137.     $(NATIVECC) $(NATIVECFLAGS) -o $(ATRANS) $(ATRANSOBJ) \
  138.         $(NATIVELIBS)
  139.  
  140. asmtab.o: asmtab.c asmtrans.h
  141.     $(NATIVECC) $(NATIVECFLAGS) -o $@ -c asmtab.c
  142.  
  143. trutil.o: trutil.c asmtrans.h
  144.     $(NATIVECC) $(NATIVECFLAGS) -o $@ -c trutil.c
  145.  
  146. trans.o: trans.c asmtrans.h
  147.     $(NATIVECC) $(NATIVECFLAGS) -o $@ -c trans.c
  148.  
  149.  
  150. asmtab.c asmtab.h:    asm.y
  151.     $(YACC) -d asm.y
  152.     mv $(YTABC) asmtab.c
  153.     mv $(YTABH) asmtab.h
  154.  
  155. # the magic number include file is generated automagically
  156. # NOTE that of course, magic.i can only reliably be generated
  157. # on an Atari ST; if you're cross-compiling, you'll have
  158. # to edit magic.i by hand
  159. # for cross compilers; uncomment the following definitions
  160. # and comment out the other ones below
  161.  
  162. # for cross-compiling
  163.  
  164. # GENMAGICPRG=echo
  165. # magic.i: proc.h file.h genmagic.c
  166. #    echo "Warning: magic.i may be out of date"
  167.  
  168. #for native compiling
  169.  
  170. GENMAGICPRG=genmagic.ttp
  171.  
  172. $(GENMAGICPRG): genmagic.c proc.h file.h
  173.     $(CC) $(CFLAGS) -DGENMAGIC -o $(GENMAGICPRG) genmagic.c
  174.  
  175. magic.i: $(GENMAGICPRG)
  176.     $(GENMAGICPRG) $@
  177.  
  178. #
  179. # assembler source files
  180. #
  181. .SUFFIXES: .spp .o0
  182.  
  183. .spp.o:
  184.     $(ATRANS) $(DEFS) -gas -o $*.s $<
  185.     $(AS) $(ASFLAGS) -o $@ -c $*.s
  186.     $(RM) $*.s
  187. .spp.o0:
  188.     $(ATRANS) $(DEFS030) -gas -o $*.s $<
  189.     $(AS) $(ASFLAGS0) -o $@ -c $*.s
  190.     $(RM) $*.s
  191. .c.o0:
  192.     $(CC) $(CFLAGS030) -o $@ -c $<
  193.  
  194. context.o: context.spp magic.i $(ATRANS)
  195. intr.o: intr.spp magic.i $(ATRANS)
  196. syscall.o: syscall.spp magic.i $(ATRANS)
  197. quickzer.o: quickzer.spp $(ATRANS)
  198. quickmov.o: quickmov.spp $(ATRANS)
  199. cpu.o: cpu.spp $(ATRANS)
  200.  
  201. context.o0: context.spp magic.i $(ATRANS)
  202. intr.o0: intr.spp magic.i $(ATRANS)
  203. syscall.o0: syscall.spp magic.i $(ATRANS)
  204. quickzer.o0: quickzer.spp $(ATRANS)
  205. quickmov.o0: quickmov.spp $(ATRANS)
  206. cpu.o0: cpu.spp $(ATRANS)
  207.  
  208. #
  209. # mkptypes generates prototypes from C source code. If you don't have it,
  210. # you'll have to add/delete function prototypes by hand.
  211. # also: Sozobon users will have to edit proto.h by hand to change the
  212. #    #if defined(__STDC__) || defined(__cplusplus)
  213. # line into
  214. #    #if __STDC__
  215. #
  216. proto.h: $(CFILES)
  217.     mkptypes $(CFILES) >proto.h
  218.  
  219. #
  220. # macros for cleaning up
  221. #
  222. GENFILES= $(OBJS) $(OBJS030) $(ATRANSOBJ) $(ATRANS) $(GENMAGICPRG)
  223. EXTRAS= asmtab.c asmtab.h mint.prg
  224.  
  225. clean:
  226.     $(RM) $(GENFILES)
  227.  
  228. realclean:
  229.     $(RM) $(GENFILES) $(EXTRAS)
  230.  
  231. #
  232. # misc. files and subdirectories to include in the distribution
  233. #
  234. MISCFILES = copying readme changes makefile makefile.lcc mintlc.prj \
  235.     genmagic.c purec asmtrans.ttp
  236.  
  237. #
  238. # macros for making distribution packages
  239. #
  240.  
  241. dist:
  242.     zoo a//h mintsrc.zoo $(MISCFILES) $(CFILES) $(HFILES) $(SFILES) \
  243.      $(ATRANSSRC)
  244.